package com.hedl.practice.studyRandom;

import java.util.Random;

public class Randoms {
    public static void main(String[] args) {
        //生成范围内的随机数
        /*double x = Math.random();
        double min = 50;
        double max = 100;
        System.out.println("---随机数--->"+x);
        double y = x * (max - min) +min;    //
        long n = (long) y;
        System.out.println(y);
        System.out.println(n);*/

        //Random
       /* Random r = new Random();
        System.out.println("int---->"+r.nextInt());
        System.out.println(r.nextInt(10));
        System.out.println("long---->"+r.nextLong());
        System.out.println("float---->"+r.nextFloat());
        System.out.println("double---->"+r.nextDouble());*/

        //random指定随机数种子
        Random r = new Random(12345);
        for (int i = 0;i < 10;i++){
            System.out.println(r.nextInt(100));
        }
    }
}
